/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package game;

/**
 *
 * @author jarrett
 */
import javax.swing.JFrame;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.geom.Ellipse2D;
import javax.swing.JPanel;

public class Game extends JPanel {

    /**
     * @param args the command line arguments
     */
    static Ball ball = new Ball(30, 1, 3);
    static Ball ball2 = new Ball(10, 1, 1);
    
    public void paint(Graphics g) {
        super.paint(g);
        Graphics2D g2d = (Graphics2D) g;
        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        g2d.setColor(Color.RED);
        ball.drawBall(g2d);
        ball2.drawBall(g2d);
        
    }
    
    public static void main(String[] args) throws InterruptedException{
        JFrame frame = new JFrame("Bouncing Ball");
        Game game = new Game();
        frame.add(game);
        frame.setSize(300, 300);
        frame.setVisible(true);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        
        while(true) {
            ball.checkBounds(game);
            ball.updatePosition();
            ball2.checkBounds(game);
            ball2.updatePosition();
            game.repaint();
            Thread.sleep(10);
        }
        
    }
    
}
